package com.news.gpb.controller;

import com.news.gpb.dao.UserDao;
import com.news.gpb.entity.Coll;
import com.news.gpb.entity.Like;
import com.news.gpb.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin("http://localhost:8080")
@RestController
public class LikeCollectController {

    @Autowired
    UserService userService;

    @RequestMapping("getLike")
    int getLike(@RequestBody Like like)
    {
        return userService.countLike(like.getUser_id());
    }

    @RequestMapping("getCollect")
    int getCollect(@RequestBody Coll coll)
    {
        return userService.countCollect(coll.getUser_id());
    }
}
